using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._Generalization
{
    /// <summary>
    /// <para>Region Group</para>
    /// <para>For each cell in the output, the identity of the connected region to which that cell belongs is recorded. A unique number is assigned to each region.</para>
    /// <para>对于输出中的每个像元，将记录该像元所属的连接区域的标识。为每个区域分配一个唯一的编号。</para>
    /// </summary>    
    [DisplayName("Region Group")]
    public class RegionGroup : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public RegionGroup()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster for which unique connected regions of cells will be identified.</para>
        ///   <para>It must be of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将标识其唯一连接像元区域的输入栅格。</para>
        ///   <para>它必须是整数类型。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_raster">
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output region group raster.</para>
        ///   <para>The output is always of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出区域组栅格。</para>
        ///   <para>输出始终为整数类型。</para>
        /// </xdoc></para>
        /// </param>
        public RegionGroup(object _in_raster, object _out_raster)
        {
            this._in_raster = _in_raster;
            this._out_raster = _out_raster;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Region Group";

        public override string CallName => "sa.RegionGroup";

        public override List<string> AcceptEnvironments => ["autoCommit", "cellSize", "cellSizeProjectionMethod", "compression", "configKeyword", "extent", "geographicTransformations", "mask", "outputCoordinateSystem", "scratchWorkspace", "snapRaster", "tileSize", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _out_raster, _number_neighbors.GetGPValue(), _zone_connectivity.GetGPValue(), _add_link.GetGPValue(), _excluded_value];

        /// <summary>
        /// <para>Input raster</para>
        /// <para><xdoc>
        ///   <para>The input raster for which unique connected regions of cells will be identified.</para>
        ///   <para>It must be of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将标识其唯一连接像元区域的输入栅格。</para>
        ///   <para>它必须是整数类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Output raster</para>
        /// <para><xdoc>
        ///   <para>The output region group raster.</para>
        ///   <para>The output is always of integer type.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>输出区域组栅格。</para>
        ///   <para>输出始终为整数类型。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_raster { get; set; }


        /// <summary>
        /// <para>Number of neighbors to use</para>
        /// <para><xdoc>
        ///   <para>Specifies the number of neighboring cells to use when evaluating connectivity between cells that define a region.</para>
        ///   <bulletList>
        ///     <bullet_item>Four—Connectivity is evaluated for the four nearest (orthogonal) neighbors of each input cell. Only the cells with the same value that share at least one side will contribute to an individual region. If two cells with the same value are diagonal from one another, they are not considered connected. This is the default.</bullet_item><para/>
        ///     <bullet_item>Eight—Connectivity is evaluated for the eight nearest neighbors (both orthogonal and diagonal) of each input cell. Cells with the same value that are connected either along a common edge or corner to each other will contribute to an individual region.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定在评估定义区域的像元之间的连通性时要使用的相邻像元数。</para>
        ///   <bulletList>
        ///     <bullet_item>四 - 评估每个输入像元的四个最近（正交）邻居的连通性。只有具有相同值且至少共享一侧的细胞才会对单个区域做出贡献。如果两个具有相同值的单元格彼此对角线，则不将其视为连接。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>八 - 评估每个输入像元的八个最近邻（正交和对角线）的连通性。沿公共边或拐角相互连接的具有相同值的像元将构成单个区域。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Number of neighbors to use")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _number_neighbors_value _number_neighbors { get; set; } = _number_neighbors_value._FOUR;

        public enum _number_neighbors_value
        {
            /// <summary>
            /// <para>Four</para>
            /// <para>Four—Connectivity is evaluated for the four nearest (orthogonal) neighbors of each input cell. Only the cells with the same value that share at least one side will contribute to an individual region. If two cells with the same value are diagonal from one another, they are not considered connected. This is the default.</para>
            /// <para>四 - 评估每个输入像元的四个最近（正交）邻居的连通性。只有具有相同值且至少共享一侧的细胞才会对单个区域做出贡献。如果两个具有相同值的单元格彼此对角线，则不将其视为连接。这是默认设置。</para>
            /// </summary>
            [Description("Four")]
            [GPEnumValue("FOUR")]
            _FOUR,

            /// <summary>
            /// <para>Eight</para>
            /// <para>Eight—Connectivity is evaluated for the eight nearest neighbors (both orthogonal and diagonal) of each input cell. Cells with the same value that are connected either along a common edge or corner to each other will contribute to an individual region.</para>
            /// <para>八 - 评估每个输入像元的八个最近邻（正交和对角线）的连通性。沿公共边或拐角相互连接的具有相同值的像元将构成单个区域。</para>
            /// </summary>
            [Description("Eight")]
            [GPEnumValue("EIGHT")]
            _EIGHT,

        }

        /// <summary>
        /// <para>Zone grouping method</para>
        /// <para><xdoc>
        ///   <para>Defines which cell values should be considered when testing for connectivity.</para>
        ///   <bulletList>
        ///     <bullet_item>Within—Connectivity for a region is evaluated for input cells that are part of the same zone (cell value). The only cells that can be grouped are cells from the same zone that meet the spatial requirements of connectivity specified by the Number of neighbors to use parameter (four or eight). This is the default.</bullet_item><para/>
        ///     <bullet_item>Cross—Connectivity for a region is evaluated between cells of any value, except for the zone cells identified to be excluded by the Excluded value parameter, and subject to the spatial requirements specified by the Number of neighbors to use parameter. Groupings of regions in the input that are separated from other groupings by a buffer of NoData cells will be processed independently from each other.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>定义在测试连通性时应考虑的单元格值。</para>
        ///   <bulletList>
        ///     <bullet_item>内部 - 针对属于同一区域的输入像元（像元值）评估区域的连通性。唯一可以分组的像元是来自同一区域的像元，这些像元满足使用邻域数参数（4 或 8）指定的连通性空间要求。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>交叉 - 在任意值的像元之间评估区域的连通性，但被排除值参数标识为排除的区域像元除外，并受要使用的邻域数参数指定的空间要求的约束。输入中通过 NoData 单元格缓冲区与其他分组分隔的区域分组将彼此独立处理。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Zone grouping method")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _zone_connectivity_value _zone_connectivity { get; set; } = _zone_connectivity_value._WITHIN;

        public enum _zone_connectivity_value
        {
            /// <summary>
            /// <para>Within</para>
            /// <para>Within—Connectivity for a region is evaluated for input cells that are part of the same zone (cell value). The only cells that can be grouped are cells from the same zone that meet the spatial requirements of connectivity specified by the Number of neighbors to use parameter (four or eight). This is the default.</para>
            /// <para>内部 - 针对属于同一区域的输入像元（像元值）评估区域的连通性。唯一可以分组的像元是来自同一区域的像元，这些像元满足使用邻域数参数（4 或 8）指定的连通性空间要求。这是默认设置。</para>
            /// </summary>
            [Description("Within")]
            [GPEnumValue("WITHIN")]
            _WITHIN,

            /// <summary>
            /// <para>Cross</para>
            /// <para>Cross—Connectivity for a region is evaluated between cells of any value, except for the zone cells identified to be excluded by the Excluded value parameter, and subject to the spatial requirements specified by the Number of neighbors to use parameter. Groupings of regions in the input that are separated from other groupings by a buffer of NoData cells will be processed independently from each other.</para>
            /// <para>交叉 - 在任意值的像元之间评估区域的连通性，但被排除值参数标识为排除的区域像元除外，并受要使用的邻域数参数指定的空间要求的约束。输入中通过 NoData 单元格缓冲区与其他分组分隔的区域分组将彼此独立处理。</para>
            /// </summary>
            [Description("Cross")]
            [GPEnumValue("CROSS")]
            _CROSS,

        }

        /// <summary>
        /// <para>Add link field to output</para>
        /// <para><xdoc>
        ///   <para>Specifies whether a link field will be added to the table of the output when the Zone grouping method parameter is set to Within. It is ignored if that parameter is set to Cross.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—A LINK field will be added to the table of the output raster. This field stores the value of the zone to which the cells of each region in the output belong, according to the connectivity rule defined in the Number of neighbors to use parameter. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—A LINK field will not be added. The attribute table for the output raster will only contain the Value and Count fields.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定当“区域分组方法”参数设置为“内部”时，是否将链接字段添加到输出表中。如果该参数设置为 Cross，则忽略该参数。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - LINK 字段将添加到输出栅格的表中。此字段根据要使用的邻居数参数中定义的连通性规则，存储输出中每个区域的像元所属的区域的值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 不会添加 LINK 字段。输出栅格的属性表将仅包含值和计数字段。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Add link field to output")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _add_link_value _add_link { get; set; } = _add_link_value._true;

        public enum _add_link_value
        {
            /// <summary>
            /// <para>ADD_LINK</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("ADD_LINK")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NO_LINK</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NO_LINK")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Excluded value</para>
        /// <para><xdoc>
        ///   <para>A value that excludes all cells of that zone from the connectivity evaluation. If a cell location contains the value, no spatial connectivity will be evaluated, regardless of how the number of neighbors is specified.</para>
        ///   <para>Cells with the excluded value will be treated in a similar way to NoData cells, and are eliminated from consideration in the operation. Input cells that contain the excluded value will receive 0 on the output raster. The excluded value is similar to the concept of a background value.</para>
        ///   <para>By default, there is no value defined for this parameter, which means that all of the input cells will be considered in the operation.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>从连通性评估中排除该区域的所有像元的值。如果像元位置包含该值，则无论如何指定邻居数，都不会评估空间连通性。</para>
        ///   <para>具有排除值的像元将以与 NoData 像元类似的方式进行处理，并在操作中从考虑中消除。包含排除值的输入像元将在输出栅格上获得 0。排除的值类似于背景值的概念。</para>
        ///   <para>默认情况下，没有为此参数定义任何值，这意味着在操作中将考虑所有输入单元格。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Excluded value")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _excluded_value { get; set; } = null;


        public RegionGroup SetEnv(int? autoCommit = null, object cellSize = null, object compression = null, object configKeyword = null, object extent = null, object geographicTransformations = null, object mask = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object snapRaster = null, double[] tileSize = null, object workspace = null)
        {
            base.SetEnv(autoCommit: autoCommit, cellSize: cellSize, compression: compression, configKeyword: configKeyword, extent: extent, geographicTransformations: geographicTransformations, mask: mask, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, tileSize: tileSize, workspace: workspace);
            return this;
        }

    }

}